<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>#IfTimeout</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>


<h1>#IfTimeout <span class="ver">[AHK_L 8+]</span></h1>

<p>Sets the maximum time that may be spent evaluating a single <a href="_If.htm">#If</a> expression.</p>

<pre class="Syntax">#IfTimeout Timeout</pre>
<h3>Parameters</h3>
<dl>

  <dt>Timeout</dt>
  <dd><p>The timeout value to apply globally, in milliseconds.</p></dd>

</dl>

<h3>Remarks</h3>
<p>A timeout is implemented to prevent long-running expressions from stalling keyboard input processing. If the timeout value is exceeded, the expression continues to evaluate, but the keyboard hook continues as if the expression had already returned false.</p>
<p>If this directive is unspecified in the script, it will behave as though set to 1000.</p>
<p>Note that the system implements its own timeout, defined by the DWORD value <em>LowLevelHooksTimeout</em> in the following registry key:</p>
<p><b>HKEY_CURRENT_USER\Control Panel\Desktop</b></p>
<p>If the system timeout value is exceeded, the system may stop calling the script's keyboard hook, thereby preventing hook hotkeys from working until the hook is re-registered or the script is <a href="Reload.htm">reloaded</a>. The hook can <em>usually</em> be re-registered by <a href="Suspend.htm">suspending</a> and un-suspending all hotkeys. </p>
<p>If a given hotkey has multiple #If variants, the timeout might be applied to each variant independently, making it more likely that the system timeout will be exceeded. This may be changed in a future update.</p>
<h3>Related</h3>
<p><a href="_If.htm">#If</a></p>
<h3>Example</h3>
<pre class="NoIndent">#IfTimeout 10 <em>; Set the timeout to 10 ms.</em></pre>

</body>
</html>
